package file;

import java.io.File;

public class Test {
    public static void main(String[] args) {
        File dir = new File("./abc");
        delete(dir);
    }
    public static void delete(File file){
        if (file.isDirectory()){
            //清空目录
            File[] subs = file.listFiles();
            for (int i = 0;i< subs.length;i++){
                File sub = subs[i];
                delete(sub);//递归调用
            }
        }
        file.delete();
    }
}
